package DemoPoint;

public class Test {

    public static void Func(Animal animal){
        animal.eat();
    }

    public static  void show(IRun iRun){
        iRun.run();
    }

    public static void main(String[] args) {
        Duck duck = new Duck("小罗",10);
        duck.eat();
        duck.fly();
        duck.swim();
        duck.run();

        System.out.println();

        Fish fish = new Fish("阿泽",10);
        fish.eat();
        fish.swim();
        System.out.println();

        //接口不能自己创建对象，但可以发生动态绑定
//        ISwim iSwim = new Duck( "小罗",10);
//        iSwim.swim();

        System.out.println();
        show(new Duck("唐老鸭",10));
        show(new Mouse("米老鼠",10));

        System.out.println();
        //利用动态绑定（多态）
        Func(new Duck("小罗",10));
        Func(new Fish("阿泽",10));

    }
}
